clear;
tic
it=100000;
n=100000;
s=zeros(it,1);
parfor i=1:it
A=rand(n,2);
B=-1+A.*2;
C=pdist2(B,[0 0]);
s(i)=sum(C<=1);
end

pi=sum(s)*4/(it*n)
toc